# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudAsset.V1.Model.EffectiveIamPolicy do
  @moduledoc """
  The effective IAM policies on one resource.

  ## Attributes

  *   `fullResourceName` (*type:* `String.t`, *default:* `nil`) - The [full_resource_name] (https://cloud.google.com/asset-inventory/docs/resource-name-format) for which the policies are computed. This is one of the BatchGetEffectiveIamPoliciesRequest.names the caller provides in the request.
  *   `policies` (*type:* `list(GoogleApi.CloudAsset.V1.Model.PolicyInfo.t)`, *default:* `nil`) - The effective policies for the full_resource_name. These policies include the policy set on the full_resource_name and those set on its parents and ancestors up to the BatchGetEffectiveIamPoliciesRequest.scope. Note that these policies are not filtered according to the resource type of the full_resource_name. These policies are hierarchically ordered by PolicyInfo.attached_resource starting from full_resource_name itself to its parents and ancestors, such that policies[i]'s PolicyInfo.attached_resource is the child of policies[i+1]'s PolicyInfo.attached_resource, if policies[i+1] exists.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :fullResourceName => String.t() | nil,
          :policies => list(GoogleApi.CloudAsset.V1.Model.PolicyInfo.t()) | nil
        }

  field(:fullResourceName)
  field(:policies, as: GoogleApi.CloudAsset.V1.Model.PolicyInfo, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.CloudAsset.V1.Model.EffectiveIamPolicy do
  def decode(value, options) do
    GoogleApi.CloudAsset.V1.Model.EffectiveIamPolicy.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudAsset.V1.Model.EffectiveIamPolicy do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
